import xlrd
import json
from datetime import datetime

if __name__ == '__main__':
    workbook = xlrd.book.open_workbook_xls( '/Users/xuyihang/Desktop/QC01-不合格审理表单.xlsx' )
    datasheet = workbook.sheet_by_name( "Sheet2" )
    nrows = datasheet.nrows
    person = {}
    for i in range( 1, nrows ):
        values = datasheet.row_values( i )
        loads = json.loads( values[1] )
        loads_ = loads[0]
        json_loads = json.loads( loads_['params'] )
        collect = json_loads['collect_time']
        receive = json_loads['receive_time']
        collect_time = datetime.strptime( collect, '%Y-%m-%d %H:%M:%S' )
        receive_time = datetime.strptime( receive, '%Y-%m-%d %H:%M:%S' )
        time = receive_time - collect_time
        print( time )
